//
//  NewTableViewCell.m
//  wangyi
//
//  Created by apple on 15/11/23.
//  Copyright © 2015年 liyinkai. All rights reserved.
//

#import "NewTableViewCell.h"
#import "UIImageView+ShowImage.h"
@implementation NewTableViewCell
//-(void)dealloc {
//    [_imageview release];
//    [_title release];
//    [_news release];
//    [super dealloc];
//}
-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        [self addSubview:self.imageview];
        [_imageview release];
        [self addSubview:self.title];
        [_title release];
        [self addSubview:self.news];
        [_news release];
    }
    return self;
}

-(void)setModel:(ToutiaoModel *)model {
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    [_imageview WXZM:_model.imgsrc];
    _title.text = _model.title;
    _news.text = _model.digest;
}

-(UIImageView *)imageview {
    if (!_imageview) {
        self.imageview = [[UIImageView alloc] initWithFrame:CGRectZero];
        [_imageview release];
    }
    return _imageview;
}
-(UILabel *)title {
    if (!_title) {
        self.title = [[UILabel alloc] initWithFrame:CGRectZero];
        [_title release];
        
    }
    return _title;
}
-(UILabel *)news {
    if (!_news) {
        self.news = [[UILabel alloc] initWithFrame:CGRectZero];
        _news.numberOfLines = 0;
        _news.font = [UIFont systemFontOfSize:13];
        [_news release];
    }
    return _news;
}

-(void)layoutSubviews {
    [super layoutSubviews];
    _imageview.frame = CGRectMake(10, 20, 93, 70);
    _title.frame = CGRectMake(110, 20, self.bounds.size.width - 110, 18);
    _news.frame = CGRectMake(110, 45, self.bounds.size.width - 110, 41);
}

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
